﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    ViewBag.Title = "添加日期";
}

<a href="@Url.Action("DailyList")" class="layui-btn">返回日期列表</a>

<div class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
            <input id="txtrq" type="text" class="layui-input" placeholder="yyyy-MM-dd" />
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" onclick="ok();">提交</button>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <ul id="ulresult"></ul>
        </div>
    </div>
</div>



@section script{
    <script>
        //日期初始化
        layui.laydate.render({
            elem: '#txtrq'
        });
        function ok() {
            let url = "@Url.Action("Daily_Save")";
            let obj = new Object();
            obj.ID = 0;
            obj.Date = $("#txtrq").val();
            $.ajax({
                type: "POST",
                //contentType: "application/json;charset=UTF-8",
                url: url,
                data: obj,
                success: function (result) {
                    layer.msg(result.msg);
                    var li = $("<li></li>").text(JSON.stringify(result));
                    $("#ulresult").append(li);
                }
            });
        }
    </script>
}